<%--
  Created by IntelliJ IDEA.
  User: Reimu
  Date: 2022/5/7
  Time: 12:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>login2</title>
</head>
<body>
<%
    String rememberedUserName = "";
    String rememberedPassWord = "";
    Cookie[] cookies = request.getCookies();
    if (cookies != null) {
        for (int i = 0; i < cookies.length; i++) {
            Cookie c = cookies[i];
            if (c.getName().equals("userName")) {
                rememberedUserName = c.getValue();
            }
            if (c.getName().equals("passWord")) {
                rememberedPassWord = c.getValue();
            }
        }
    }
%>
<form action="" method="post">
    用户名： <input type="text" name="userName" value="<%=rememberedUserName%>"><br><br>
    密码：<input type="password" name="passWord" value="<%=rememberedPassWord%>"><br><br>
    <input type="checkbox" name="remember" value="member"
        <%
            if (! rememberedUserName.equals("")&&!rememberedPassWord.equals("")){
                out.print("checked");
            }
            %>
    >记住密码 <br>
    <input type="submit" value="登录">
</form>

</body>
</html>
